package com.ticket.sass.ticketserver.controller

import com.github.xiaoymin.knife4j.annotations.ApiSupport
import com.ticket.sass.common.ticketserver.dto.output.HallOutput
import com.ticket.sass.common.ticketserver.dto.output.ScheduleOutput
import com.ticket.sass.common.ticketserver.dto.output.ScheduleSeatMapOutput
import com.ticket.sass.ticketserver.business.BasicDataBusiness
import com.ticket.sass.ticketserver.dto.input.ScheduleInput
import com.ticket.sass.ticketserver.dto.input.ScheduleSeatMapInput
import com.ticket.sass.ticketserver.dto.output.ResultWrapOutput
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.util.concurrent.TimeUnit
import javax.validation.Valid


/**
 * @author 朱其鹏
 * @date 2024/3/20 18:02
 */
@RestController
@RequestMapping("/basic-data")
@ApiSupport(order = 1)
@Api(tags = ["基础数据接口"])
class BasicDataController(
    private val basicDataBusiness: BasicDataBusiness,
) {
    @ApiOperation("获取影厅数据")
    @GetMapping("/halls")
    fun halls(): ResultWrapOutput<HallOutput> {
        return ResultWrapOutput.success(basicDataBusiness.halls())
    }

    @ApiOperation("获取排期数据")
    @GetMapping("/schedules")
    fun schedules(@Valid input: ScheduleInput): ResultWrapOutput<ScheduleOutput> {
        return ResultWrapOutput.success(basicDataBusiness.schedules(input))
    }

    @ApiOperation("获取排期座位图")
    @GetMapping("/schedules/seat-map")
    fun scheduleSeatMap(@Valid input: ScheduleSeatMapInput): ResultWrapOutput<ScheduleSeatMapOutput> {
        return ResultWrapOutput.success(basicDataBusiness.scheduleSeatMap(input))
    }
}